﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace EasySL.Core
{
    public class DataServiceHandler<T> : IHttpHandler where T : new()
    {
        private static DataService<T> dataService;
        
        public void ProcessRequest(HttpContext context)
        {
            if (dataService == null)
                dataService = new DataService<T>();
            
            if (context.Request.Form["request"] != null)
            {
                string request = context.Request.Form["request"];

                context.Response.Write(dataService.GetData(request));
            }   
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
